#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 
# Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
# 

"""
File: jieba_intro.py
Author: zhangyang(zhangyang40@baidu.com)
Date: 2017/9/26 上午11:26
"""

import sys

reload(sys)
sys.setdefaultencoding('utf-8')
import jieba.posseg

if __name__ == "__main__":

    f = open('./24.novel.txt')
    str = f.read().decode('utf-8')
    f.close()

    seg = jieba.posseg.cut(str)
    for s in seg:
        print s.word, s.flag, '|',
        # print s.word, '|',
